home *** CD-ROM | disk | FTP | other *** search
-
- Partial Renumber Routine
- ------------------------
-
- The partial renumber routine as supplied works extremely well. I have
- employed it with a wide variety of programs with complete success, and
- would therefore like to extend my congratulations and appreciation to
- the author.
-
- I have, however, disvcovered a number of small items which I feel I
- should bring to your attention. Ideally, I would have liked to offer a
- revised version of the routine for your opinion, but I have found the
- code rather difficult to follow.
-
- The routine starts by asking for various input parameters, such as the
- start and end line numbers for renumbering. These are not checked. If
- return is pressed the line number is defaulted. However, if a start line
- number with a greater value than the end line number is entered, the
- routine will still faithfully attempt a renumber...
-
-
-
- The routine also permits the user to issue a renumber that would alter
- the structure of a program. For example, take a small program such as
- the one below:-
-
- 10 REM Line 1
- 20 REM Line 2
- 30 REM Line 3
- 40 REM Line 4
-
- This may be amended by the routine using input parameters of:-
-
- 20,30,100,10,0
-
- to read:-
-
- 10 REM Line 1
- 100 REM Line 2
- 110 REM Line 3
- 40 REM Line 4
-
- In effect, there is nothing wrong with this. It is just that BBC Basic
- is not capable of re-shuffling the program, and that will cause a
- problem. There are two possible solutions to this programmer. The first
- is to build a chek routine into the renumber utility preventing the
- above renumber from starting. (Could be a rather difficult job - I
- don't know). The second is to leave such a problem to the programmer to
- resolve.
-
- How? Simple. SPOOL the program to disc, then EXEC the generated file
- back into memory. This imitates the program being typed in from the
- keyboard, allowing BASIC to sort out where to stick each line in turn.
-
- In the above example, this would result in the following:-
-
- 10 REM Line 1
- 40 REM Line 4
- 100 REM Line 2
- 110 REM Line 3
-
-
- In the time that I have been using the routine, I have found that I very
- quickly adopted a standard method of renumbering a program.
-
- 1. Renumber the routine itself to a block of line numbers that do not
- exist in the program to be amended. (For my own software, I know
- that lines 64000 to 65535 are always unused). It is best to add
- the procedure to the end of the program you wish to renumber,
- since BBC Basic provides the APPEND statement.
-
- 2. Save this to disc under the name RENUM either as a basic program
- or as a spooled file.
-
- 3. Either append the PROCRENUM to your program, or create a spooled
- version and use EXEC to add it to the code of your own program.
-
- 4. Call PROCRENUM to make the required changes. Ensure that they are
- correct with a quick LIST.
-
- 5. Delete the lines of your program that contain the RENUM routines.
- This will leave only the amended program in memory.
-
- 6. Save this back to disc.
-
- RENUM and its associated procedures do not declare local variables. For
- that reason I was reluctant to leave it as part of a program and call it
- when required, since a clash of variable names may have occured.
-
- In reality, the comments I have made are superfluous to the functioning
- of the utility. A careful programmer can check his line numbers before
- calling the procedure to ensure that the above listed error conditions
- are not permitted to occur.
-
-